const { ccclass, property } = cc._decorator;

@ccclass
export default class QueryUrl extends cc.Component {

    //获取当前地址
    public static getQueryVariable(variable) {

        let reg = new RegExp("(^|&)" + variable + "=([^&]*)(&|$)"); // 构造一个含有目标参数的正则表达式对象
        let r = window.location.search.substr(1).match(reg); // 匹配目标参数
        if (r != null) return decodeURIComponent(r[2]);
        return null; // 返回参数值

    }

}
